$('.right-titleicon').on("click",function(e){
	projectVM.showMenulist()
})
	mui.plusReady(function(){
		 console.log("当前页面URL："+plus.webview.currentWebview().id);
		 window.addEventListener('ttTT', function(event) {//A页面自定义事件
			projectVM.getList("");
		 });
	});

	let that;
		projectVM = new Vue({
			el: "#content",
			data: {
				searchStr:"",//搜索框参数
				searchType:"todo",
				modifyBy:"",//当前操作人号码
				onStatus:false,
				showPop:false,
				showMenu:false,
				onlyselect:true,
				menuList:[{name:'投入',path:'goIn.html'},{name:'退出',path:'goOut.html'}],
				filterText:'all', //筛选条件
				list:[],
				page:1,
			},
			created: function() {
				that = this;
			},
			mounted() {
				setTimeout(that.getList,500);
				setTimeout(that.initParam,500);
				
			},
			
			methods: {
				searchDevice(e){
					that.page = 1;
					console.log(that.searchStr)
					that.getList(that.searchStr)
				},
				initParam(){
					let config = mui.neioConfig.getNeioConfig();
					let key = config.KEYS.DEVOICE;
					mui.neioConfig.setStorage(key,"");
					
					let netKey = config.KEYS.NET_WORK_DETAIL;
					mui.neioConfig.setStorage(netKey,"");
				},
				//获取投退记录列表
				getList(str){
					that.initParam();
					let persionData = JSON.parse(localStorage.getItem("neiosUser"));
					that.modifyBy = persionData.userId;//当前登录人
					let config = mui.neioConfig.getNeioConfig()
					let url = config.URL.queryNetDevice;
					let param = {};
					param.pageSize = '10';
					param.pageIndex = that.page;
					param.stationCode = localStorage.getItem('neiosStationCode') == null ? '1020' : localStorage.getItem('neiosStationCode');
					param.role = 'NEIOS_STATION';//persionData.roles;
					param.searchStr = str;
					param.searchType = '0';//固定传0
					console.log(JSON.stringify(param))
					mui.neiosRequst.httpRequst(url,param,function(ret){
						console.log("列表数据:"+JSON.stringify(ret))
						if(ret.code == 0){
						if(ret.code == 0){
							if(that.page == 1){
								mui('#scroll').pullRefresh().enablePullupToRefresh();
								mui('#scroll').pullRefresh().endPullupToRefresh();
								that.list = ret.data.records
							}
							if(ret.data.current >= ret.data.pages){
								console.log("====================禁用====================") 
								mui('#scroll').pullRefresh().disablePullupToRefresh();
								mui('#scroll').pullRefresh().endPullupToRefresh(true);
							}
							else{
								mui('#scroll').pullRefresh().endPullupToRefresh();
								that.list = that.list.concat(ret.data.records)
							}
						}
						}
						if( ret.code == 1){
							mui.toast(ret.msg)
						}
					},function(err){
						console.log("失败回掉："+JSON.stringify(err))
					})
				},
				//删除操作
				itemDelete(item){
					this.hideOperBtn()
					mui.confirm('是否删除','提示',['取消','确认'],function (e) {
						if(1 == e.index){
							let datas = mui.neioConfig.getDevoice(item,0,1,that);
							
							let config = mui.neioConfig.getNeioConfig();
							let url = config.URL.saveOrUpdateNetDevice;
							mui.neiosRequst.httpRequst(url,datas,function(ret){
								if(ret.code == 0){
									that.page = 1;
									mui.toast(ret.msg)
									that.getList("");
								}
								if( ret.code == 1){
									mui.toast(ret.msg)
								}
							},function(err){
								console.log("失败回掉："+JSON.stringify(err))
							})
						}
					},'div')
					
				},
				clickStop(){

				},
				//存入详情页需要的参数
				saveDetailParam(item){
					this.hideOperBtn()
					let config = mui.neioConfig.getNeioConfig();
					let key = config.KEYS.NET_WORK_DETAIL;
					mui.neioConfig.setStorage(key,JSON.stringify(item));
					that.navTo('detail.html');
				},
				//存入编辑页需要的参数
				/**
				 * @param {Object} item 列表数据
				 */
				saveEditParam(item){
					this.hideOperBtn()
					let config = mui.neioConfig.getNeioConfig();
					let key = config.KEYS.DEVOICE;
					mui.neioConfig.setStorage(key,JSON.stringify(item));
					if(item.inTime != null){
						//投入
						that.navTo('goIn.html');
					}
					if(item.outTime != null){
						//退出
						that.navTo('goOut.html');
					}
				},
				navTo(e){
					mui.openWindow({
            			url: e,
            			id: e,
						extras: {},
					waiting: {
					autoShow: false
					}
        			});
				},
				//点击菜单
				menuClick(e){
					that.showMenu = false;
					if(e.name == '我值班'){
						this.onStatus? this.onStatus= false : this.onStatus=true
					}
					else{
						this.navTo(e.path)
					}
				},
				//左上角菜单显示隐藏
				showMenulist(){
					this.showMenu?this.showMenu=false:this.showMenu=true
				},
				//切换筛选条件
				changeFliter(e){
					this.filterText = e
				},
				showPop(){
					this.show_popup = true
				},
				hidePopup(){
				this.show_popup = false	
				},
				//获取格式化后的时间
				getTime(timer){
					let times = mui.neiosCommon.transTime(new Date(timer),'min')
					return times;
				},
				hideOperBtn () {
					$('.todo').css('width','0');
					$('.toAppoint').css('width','0');
				},
			}
			
			})
			
			// 显示操作按钮
			function showOperBtn (el) {
				console.log(el);
				$('.todo').css('width','0');
				$(el).next().css('width','39vw');
			}

		

	mui.init({
      pullRefresh: {
        container: "#scroll", //待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
        down: { //下拉刷新
		  style: 'circle',
          height: 50, //可选,默认50.触发下拉刷新拖动距离,
          auto: false, //可选,默认false.首次加载自动下拉刷新一次
          contentdown: "下拉可以刷新", //可选，在下拉可刷新状态时，下拉刷新控件上显示的标题内容
          contentover: "释放立即刷新", //可选，在释放可刷新状态时，下拉刷新控件上显示的标题内容
          contentrefresh: "正在刷新...", //可选，正在刷新状态时，下拉刷新控件上显示的标题内容
          callback: async function() { //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
            projectVM.page = 1;
			
			projectVM.searchStr = "";
            projectVM.getList("");
            ////没有更多内容了，endPulldown 传入true， 不再执行下拉刷新
			mui('#scroll').pullRefresh().endPulldownToRefresh();
			mui('#scroll').pullRefresh().enablePullupToRefresh();
			mui('#scroll').pullRefresh().endPullupToRefresh(true); 
        }
        },
        up: { //上拉加载
          height: 50, //可选.默认50.触发上拉加载拖动距离
          auto: false, //可选,默认false.自动上拉加载一次
          contentrefresh: "正在加载...", //可选，正在加载状态时，上拉加载控件上显示的标题内容
          contentnomore: '没有更多数据了', //可选，请求完毕若没有更多数据时显示的提醒内容；
          callback: async function() { //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
		  
			projectVM.page = projectVM.page + 1;
            projectVM.getList("");
          }
        }
      },
    });